package com.jang.service;

import com.jang.Entity.ResponseEntity;
import com.jang.Entity.cases.CaseRuningEntity;
import com.jang.Entity.cases.ConfigEntity;
import com.jang.service.cases.CaseRuningService;
import com.jang.service.cases.ConfigService;
import com.jang.utils.ResultHandle;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@RunWith(SpringRunner.class)
@SpringBootTest
public class test {
    @Autowired
    private CaseRuningService caseRuningService;
    @Autowired
    private ConfigService configService;
    @Test
    public void test(){
       ConfigEntity configEntity =new ConfigEntity();
       configEntity.setHeader_key("timestamp");
       configEntity.setHeader_value("1590567673299");
       configService.insertHerderConfig(configEntity);
    }
    @Test
    public void  test2(){
        String test="{\"data\":{\"token\":3,\"loginName\":yanjn},\"success\":true,\"token\":\"000\",\"msg\":\"成功\"}";
        String param ="token";
        String rule1 =param+"\":(.+?),";

        String s = ResultHandle.handle("token",test,2);
        Matcher matcher1 = Pattern.compile(rule1).matcher(test);
        while (matcher1.find()) {
            System.out.println(matcher1.group(1));


        }
        System.out.println(s);
    }
    @Test
    public void test3(){
        String result = caseRuningService.CaseRuning_Post(3,1);
        System.out.println(result);
    }

    @Test
    public void  test232(){
        CaseRuningEntity caseRuningEntity =new CaseRuningEntity();
        caseRuningEntity.setProject_id(1);
        Object responseEntity = caseRuningService.CaseList(caseRuningEntity);
    }
}
